<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>渠道管理</title>
  <meta name="keywords" content="">
  <meta name="description" content="">
  <link rel="shortcut icon" href="favicon.ico">
  <script src="../../res/js/comm.js"></script>
  <script src="../../res/js/utils.js"></script>
  <link href="../../res/css/bootstrap.min14ed.css" rel="stylesheet">
  <link href="../../res/css/font-awesome.min93e3.css" rel="stylesheet">
  <link href="../../res/plugins/bootstrap/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
  <link href="../../res/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet">
  <link href="../../res/plugins/select2/css/select2.min.css" rel="stylesheet">
  <link href="../../res/plugins/iCheck/custom.css" rel="stylesheet">
  <link href="../../res/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
  
	<script src="../../res/plugins/ztree/js/jquery.ztree.core.js"></script>
	
	<script src="../../res/plugins/select2/js/select2.min.js"></script>
	
	<script src="../../res/js/ajaxUtil.js"></script>
	<script src="../../res/plugins/iCheck/icheck.min.js"></script>
	<script src="../../js/wms/select.js"></script>
  <script src="../../res/plugins/yifeng/lbsAreaSelect.js"></script>
	<script src="../../js/wms/warehouseSelect.js"></script>
  <style>
    .select2-container--open {
      z-index: 10000000000
    }
  </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="ibox float-e-margins">
    <div class="row">
      <div class="col-xs-4" style="max-width:300px;">
        <div class="ibox float-e-margins">
          <div class="ibox-content">
            <div class="row">
              <div class="col-xs-12">
                <div class="input-group">
                  <div class="col-md-10" id="channelDiv">
                    <select id="channelSelect" style="width: 200px;"
                            onchange="refreshTree(this.value)">
                    </select>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="ibox-content">
            <div class="row">
              <div class="col-xs-12">
                <div class="input-group">
                  <span class="input-group-addon">快速检索</span>
                  <input type="text" class="form-control" id="search_channel">
                </div>
              </div>
            </div>
            <div class="treebox">
              <!-- 展示菜单列表 -->
              <div class="zTreeDemoBackground pull-left">
                <span>渠道列表:</span>
                <ul id="treeDemo" class="ztree"></ul>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="col-xs-8">
        <div class="ibox float-e-margins">
          <form class="form-horizontal" id="addOrUpdateForm">
            <input type="hidden" name="selectChannelInfo" value="">
            <div class="ibox-title">
              <div>
                <button type="button" class="btn btn-success" onclick="" id="addTopChannelBtn">新增顶级渠道</button>
                <button type="button" class="btn btn-success" onclick="" id="addNextChannelBtn">新增下级渠道</button>
                <button type="button" class="btn btn-success" onclick="channelImport()" id="importChildChannelBtn">导入子渠道</button>
                <button type="button" class="btn btn-success" onclick="batchChannelUpdte()" id="batchChannelUpdteBtn">批量修改</button>
              </div>
            </div>
            <div class="ibox-content" id="channelDetailDiv">
            </div>

            <div class="ibox-footer">

            </div>

          </form>

        </div>
      </div>
    </div>

  </div>
  <!-- End Panel Basic -->


</div>

<!-- 渠道信息导入 -->
<script type="text/html" id="channelImportDiv">
  <div class="container" id="batchImportChannelDiv">
    <form method="post" class="form-horizontal" action="#" id="batchInportChannelForm">
      <input type="hidden" name="parentId" value="{{d.parentId||''}}">
      <input type="hidden" name="topChannelCode" value="{{d.topChannelCode||''}}">
      <input type="hidden" name="parentChannelCode" value="{{d.parentChannelCode||''}}">

      <div class="form-group">
        <label class="col-md-2 control-label">父渠道：</label>
        <div class="col-md-10">
          <input type="text" class="form-control form-inline" readonly name="parentChannelName" placeholder="父渠道" style="width: 290px;" value="{{d.parentChannelName||''}}"/>
        </div>
      </div>


      <div class="row">
        <div class="col-sm-8">
          <div class="form-group">
            <label class="col-md-3 control-label"><i class="snowflake"></i>营业时间：</label>
            <div class="col-md-8">
              <input type="text" class="form-control" name="serviceTime" style="width: 290px;" placeholder="请填写服务时间 比如 7：30-21：30" value="{{d.serviceTime||''}}"/>
              <span class="help-block m-b-none warningTips"><i class="fa fa-info-circle">服务时间，不填则为24小时</i></span>
            </div>
          </div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">服务模式：</label>
        <div class="col-md-10">
          <div class="row radio i-checks">
            <label>
              <input type="radio" name="serviceMode" value="O2O" checked />&nbsp;O2O&nbsp;
              <input type="radio" name="serviceMode" value="B2C" />&nbsp;B2C&nbsp;
            </label>
          </div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">是否可添加商品：</label>
        <div class="col-md-10">
          <div class="row radio i-checks">
            <label>
              <input type="radio" name="hasGoods" value="1" checked />&nbsp;可以&nbsp;
              <input type="radio" name="hasGoods" value="0"  />&nbsp;不可以&nbsp;
            </label>
          </div>
        </div>
      </div>

      <div class="hr-line-dashed"></div>

      <div class="form-group" >
        <label class="col-md-2 control-label">服务类型：</label>
        <div class="col-md-10">
          <div class="row checkbox i-checks">
            <div class="form-group">
              <label class="col-md-2 control-label"><i class="snowflake"></i>自提：</label>
              <div class="col-md-10">
                <div class="row radio i-checks">
                  <label>
                    <input type="radio" name="customerPickUp1" value="1"   />&nbsp;支持&nbsp;
                  </label>
                  <label>
                    <input type="radio" name="customerPickUp1" value="0" checked="" />&nbsp;不支持&nbsp;
                  </label>
                </div>
              </div>
            </div>
            <div class="form-group">
              <label class="col-md-2 control-label"><i class="snowflake"></i>货到付款：</label>
              <div class="col-md-10">
                <div class="row radio i-checks">
                  <label>
                    <input type="radio" name="cashOnDelivery1" value="1"  />&nbsp;支持&nbsp;
                  </label>
                  <label>
                    <input type="radio" name="cashOnDelivery1" value="0" checked="" />&nbsp;不支持&nbsp;
                  </label>
                </div>
              </div>
            </div>
          </div>
          <div class="row checkbox i-checks">
            <div class="form-group">
              <label class="col-md-2 control-label"><i class="snowflake"></i>服务范围：</label>
              <div class="col-md-10">
                <select id="batchProvince" style="width: 163px;">
                  <option value="">请选择省/直辖市</option>
                </select>
                <select id="batchCity" style="width: 163px;">
                  <option value="">请选择市</option>
                </select>
                <select id="batchDistrict" style="width: 163px;">
                  <option value="">请选择区/县</option>
                </select>
                <span class="help-block m-b-none warningTips"><i
                        class="fa fa-info-circle">不选择则表示全国范围</i></span>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label"><i class="snowflake"></i>导入EXCEL：</label>
        <div class="col-md-10">
          <div class="col-sm-3">
            <input style="width: 180px; padding-top: 5px;" name="importChannelFile" type="file" id="importChannelFile"/>
          </div>
          <div class="col-sm-6">
            <a class="btn btn-success btn-sm" href="https://img.yifengx.com/zt/templet/子渠道导入模板-ecp.xlsx">模板下载</a><font color="red">(有新版，请下载最新模板)</font>
          </div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">&nbsp;</label>
        <div class="col-md-10">
          <button class="btn btn-info" type="button" onclick="importExcel()">导入</button>
        </div>
      </div>
    </form>
  </div>

</script>

<script type="text/html" id="addOrUpdateChannelTemplate">
  <div id="addWarehouseDiv">
    <div class="wrapper wrapper-content animated fadeInRight">
      <div class="ibox float-e-margins">
        <form method="post" class="form-horizontal" action="#">
          <input type="hidden" name="id" value="{{d.id||''}}">
          <input type="hidden" name="parentCode" value="{{d.parentCode||''}}">
          <input type="hidden" name="topChannelCode" value="{{d.topChannelCode||''}}">
          <input type="hidden" name="channelConfigStr" value='{{d.channelConfigStr||""}}'>
          <div class="form-group">
            <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>渠道名称：</label>
            <div class="col-md-10">
              <input type="text" class="form-control" name="name" style="width: 290px;" placeholder="请填写渠道名称，20个字以内"  value="{{d.name||''}}"/>
            </div>
          </div>
          <div class="hr-line-dashed"></div>

          {{# if(d.treeType===0){ }}
            <div class="form-group">
              <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>渠道类型：</label>
              <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="channelType" value="OWNED" {{d.channelType!=='THIRDPARTY'?"checked=''":""}}/>&nbsp;自有渠道&nbsp;
                  <input type="radio" name="channelType" {{d.channelType==='THIRDPARTY'?"checked=''":""}}
                         value="THIRDPARTY"/>&nbsp;第三方渠道&nbsp;
                </label>
              </div>
              </div>
            </div>
          {{# } }}

          {{# if(d.parentId!=null&&d.parentId!=''&&d.parentId!='0'){ }}
            <div class="form-group">
              <label class="col-md-2 control-label">父渠道：</label>
              <div class="col-md-10">
                <input type="text" class="form-control form-inline" readonly name="parentChannelName"
                     placeholder="父渠道" style="width: 290px;" value="{{d.parentChannelName||''}}"/>
              </div>
            </div>
          {{# } }}
          <div class="form-group">
            <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>渠道编号：</label>
            <div class="col-md-8">
              <div class="input-group">
                {{# if(d.topChannelCode!=null&&d.topChannelCode!='' && (d.operationType === 0 || d.operationType === '0')){ }}
                <span class="input-group-addon" id="channelPrefix">{{d.topChannelCode}}_</span>
                {{# } }}
                <input type="text" class="form-control form-inline" {{ d.id?"readonly":""}} name="channelCode" placeholder="渠道编号长度不能超过15" 
                 style="width:290px;"value="{{d.channelCode||''}}"/>
              </div>
            </div>
          </div>

          <div class="form-group">
            <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>渠道状态：</label>
            <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="channelStatus" value="ENABLE" {{d.channelStatus!=='DISABLE'?"checked":""}}/>&nbsp;营业&nbsp;
                  <input type="radio" name="channelStatus" {{d.channelStatus==='DISABLE'?"checked":""}} value="DISABLE"/>&nbsp;停业&nbsp;
                </label>
              </div>
            </div>
          </div>

          {{# if(d.treeType===3 || d.treeType===2){ }}
          <div class="row autoClass">
            <div class="col-sm-8">
              <div class="form-group">
                <label class="col-md-3 control-label"><i class="snowflake"></i><font color="red" >* </font>营业时间：</label>
                <div class="col-md-8">
                  <input type="text" class="form-control" name="serviceTime" style="width: 290px;" placeholder="请填写服务时间 比如 7:30-21:30" value="{{d.serviceTime||''}}"/>
                  <span class="help-block m-b-none warningTips"><i class="fa fa-info-circle">服务时间，不填则为24小时</i></span>
                </div>
              </div>
            </div>
          </div>
          {{# } }}

          {{# if(d.treeType===0){ }}
          <div class="form-group">
            <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>收款类型：</label>
            <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="channelPayeeType" value="PAYEE_YIFENG" {{d.channelPayeeType!=='PAYEE_THIRD'?"checked=''":""}}/>&nbsp;益丰收款&nbsp;
                  <input type="radio" name="channelPayeeType" {{d.channelPayeeType==='PAYEE_THIRD'?"checked=''":""}} value="PAYEE_THIRD"/>&nbsp;第三方收款，定期结算&nbsp;
                </label>
              </div>
            </div>
          </div>
          <div class="form-group">
            <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>库存校验：</label>
            <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="isCheckStock" value="Y" {{d.isCheckStock==='Y'?"checked=''":""}}/>&nbsp;校验&nbsp;
                  <input type="radio" name="isCheckStock" {{d.isCheckStock==='N'?"checked=''":""}} value="N"/>&nbsp;不校验&nbsp;
                </label>
              </div>
            </div>
          </div>
          <div class="form-group">
            <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>发放积分：</label>
            <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="isGivePoint" value="Y" {{d.isGivePoint==='Y'?"checked=''":""}}/>&nbsp;发放&nbsp;
                  <input type="radio" name="isGivePoint" {{d.isGivePoint==='N'?"checked=''":""}} value="N"/>&nbsp;不发放&nbsp;
                </label>
              </div>
            </div>
          </div>
          <!-- -->
          <div class="form-group">
            <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>管制药品：</label>
            <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="allowMangeGoods" value="Y" {{d.allowMangeGoods==='Y'?"checked=''":""}}/>&nbsp;允许&nbsp;
                  <input type="radio" name="allowMangeGoods" {{d.allowMangeGoods==='N'?"checked=''":""}} value="N"/>&nbsp;禁止
                </label>
              </div>
            </div>
          </div>
          <!-- -->
          <div class="form-group">
            <label class="col-md-2 control-label"><i class="snowflake"></i><font color="red" >* </font>部分退货：</label>
            <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="isRebateRefund" value="Y" {{d.isRebateRefund==='Y'?"checked=''":""}}/>&nbsp;支持&nbsp;
                  <input type="radio" name="isRebateRefund" {{d.isRebateRefund==='N'?"checked=''":""}} value="N"/>&nbsp;不支持&nbsp;
                </label>
              </div>
            </div>
          </div>
          {{# } }}


          
          {{# if(d.treeType===3 || d.treeType===2){ }}
             <div class="form-group">
              <label class="col-md-2 control-label">渠道经度：</label>
              <div class="col-md-2">
                <div class="input-group">
                  <input type="text" class="form-control" name="longitude" placeholder="经度" value="{{d.longitude||''}}" size="10" />
                </div>
              </div>
              <label class="col-md-2 control-label">渠道纬度：</label>
              <div class="col-md-3">
                <div class="input-group">
                  <input type="text" class="form-control" name="latitude" placeholder="纬度" value="{{d.latitude||''}}" size="10"/>
                </div>
              </div>
            </div>
            <div class="form-group">
              <label class="col-md-2 control-label"><i class="snowflake"></i>地址：</label>
              <div class="col-md-8">
                <textarea name="address" class="form-control" cols="5"
                        placeholder="请填写渠道地址，100个字以内">{{d.address||''}}</textarea>
              </div>
            </div>
           {{# } }}

          <div class="hr-line-dashed"></div>

          {{# if(d.treeType===3 || d.treeType===2){ }}

          <div class="form-group">
            <label class="col-md-2 control-label">发货仓库：</label>
            <div class="col-md-5">
              <div class="input-group">
                <input type="hidden" data-oldwarehouse="{{d.warehouseCode||''}}" name="warehouseCode" value="{{d.warehouseCode||''}}">
                <input type="text" class="form-control" readonly name="warehouseCodeAndName" placeholder="选择仓库" value="{{d.warehouseCode?(d.warehouseCode+'-'+d.name):''}}"/>
                <span class="input-group-addon" onclick="openWarehouse(this)">点击选择</span>
              </div>
            </div>
          </div>
          {{# } }}

          {{# if(d.treeType===3 || d.treeType ===2){ }}
          <div class="form-group">
            <label class="col-md-2 control-label">服务模式：</label>
            <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="serviceMode" value="O2O" {{d.serviceMode!=='B2C'?"checked":""}}/>&nbsp;O2O&nbsp;
                  <input type="radio" name="serviceMode" value="B2C" {{d.serviceMode==='B2C'?"checked":""}}/>&nbsp;B2C&nbsp;
                </label>
              </div>
            </div>
          </div>

          <div class="form-group">
            <label class="col-md-2 control-label">是否可添加商品：</label>
            <div class="col-md-10">
              <div class="row radio i-checks">
                <label>
                  <input type="radio" name="hasGoods" value="1" {{d.hasGoods=='1'?"checked":""}} />&nbsp;可以&nbsp;
                  <input type="radio" name="hasGoods" value="0" {{d.hasGoods=='0'?"checked":""}} />&nbsp;不可以&nbsp;
                </label>
              </div>
            </div>
          </div>
          {{# } }}

          {{# if(d.treeType===3||d.treeType===2){ }}

          <div class="hr-line-dashed"></div>
          <div class="form-group autoClass" >
            <label class="col-md-2 control-label">服务类型：</label>
            <div class="col-md-10">
              <div class="row checkbox i-checks">
                <div id="serviceType1Div">
                  <div class="form-group">
                    <label class="col-md-2 control-label"><i class="snowflake"></i>自提：</label>
                    <div class="col-md-10">
                      <div class="row radio i-checks">
                        <label>
                          <input type="radio" name="customerPickUp1" value="1" {{d.customerPickUp === '1' ? "checked" : ""}} />&nbsp;支持&nbsp;
                        </label>
                        <label>
                          <input type="radio" name="customerPickUp1" value="0" {{d.customerPickUp === '0' ? "checked" : ""}} />&nbsp;不支持&nbsp;
                        </label>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-2 control-label"><i class="snowflake"></i>货到付款：</label>
                    <div class="col-md-10">
                      <div class="row radio i-checks">
                        <label>
                          <input type="radio" name="cashOnDelivery1" value="1" {{d.cashOnDelivery === '1' ? "checked" : ""}} />&nbsp;支持&nbsp;
                        </label>
                        <label>
                          <input type="radio" name="cashOnDelivery1" value="0" {{d.cashOnDelivery === '0' ? "checked" : ""}} />&nbsp;不支持&nbsp;
                        </label>
                      </div>
                    </div>
                  </div>
                </div>

              </div>
              <div class="row checkbox i-checks">

                <div id="serviceType2Div">
                  <div class="form-group">
                    <label class="col-md-2 control-label"><i class="snowflake"></i>服务范围：</label>
                    <div class="col-md-10">
                      <select id="province" style="width: 163px;" name="province">
                        <option value="">请选择省/直辖市</option>
                      </select>
                      <select id="city" style="width: 163px;" name="city">
                        <option value="">请选择市</option>
                      </select>
                      <select id="district" style="width: 163px;" name="district">
                        <option value="">请选择区/县</option>
                      </select>
                      <span class="help-block m-b-none warningTips"><i
                              class="fa fa-info-circle">不选择则表示全国范围</i></span>
                    </div>
                  </div>
                </div>
				
              </div>

            </div>
          </div>
          {{# } }}

          <div class="form-group">
            <label class="col-md-2 control-label">渠道说明：</label>
            <div class="col-md-10">
              <textarea name="remark" id="remark2" class="form-control" cols="5"
                        placeholder="请填写渠道说明，100字以内">{{d.remark||''}}</textarea>
            </div>
          </div>

          <button type="button" class="btn btn-primary" onclick="saveChannel('{{d.operationType}}')">保存
          </button>


        </form>
      </div>
    </div>
  </div>
</script>

<script type="text/html" id="batchUpdateChannelTemplate">
  <div id="batchUpdateChannelDiv" style="width:400px;">
    <form method="post" class="form-horizontal" action="#" id="batchUpdateChannelForm">
      
      <div class="form-group">
        <label class="col-md-4 control-label">营业时间：</label>
        <div class="col-md-8">
          <select id="inp_h" style="margin-top:8px;"></select>
          --
          <select id="end_h" style="margin-top:8px;"> </select>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-4 control-label">渠道状态：</label>
          <div class="col-md-8">
            <div class="row radio i-checks">
              <label>
                <input type="radio" name="updateChannelStatus" value="" checked/>&nbsp;不变更&nbsp;
                <input type="radio" name="updateChannelStatus" value="ENABLE" />&nbsp;营业&nbsp;
                <input type="radio" name="updateChannelStatus" value="DISABLE"/>&nbsp;停业&nbsp;
              </label>
            </div>
          </div>
      </div>

      <div class="form-group">
          <label class="col-md-4 control-label">渠道说明：</label>
            <div class="col-md-8">
              <textarea placeholder="不变更" style="width:300px;heigth:300px;" row="20" id="batchUpdateRemark"></textarea>
            </div>
      </div>

      <div class="form-group">
          <label class="col-md-4 control-label">修改渠道：</label>
            <div class="col-md-8">
              <textarea style="width:300px;heigth:300px;" id="batchUpdateChannel" readonly cols="5" placeholder="请导入要修改的渠道号"></textarea>
            </div>
      </div>

      <div class="form-group">
        <label class="col-md-4 control-label"><a href="https://img.yifengx.com/zt/templet/批量修改渠道模板-ecp.xlsx">模板下载</a></label>
        <div class="col-md-8">
          <div class="col-sm-7">
            <input style="width: 280px; padding-top: 5px;" name="importBatchChannelFile" type="file" id="importBatchChannelFile"/>
          </div>
          <div class="col-sm-1" style="float:right;">
            <a class="btn btn-success btn-sm" href="#" onclick="importBatchExcel()">上传</a>
          </div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-4 control-label">&nbsp;</label>
        <div class="col-md-8">
          <a class="btn btn-success btn-sm" href="#" onclick="saveBatchUpdate()">保存</a>
        </div>
    </div>
    </form>
  </div>
</script>
<script src="../../js/channel/channel.js"></script>
</body>
</html>